package com.example.javabasic.other;

import com.example.javabasic.thread.classtwo.future.demo1.AsyncFuture;
import org.springframework.scheduling.annotation.Async;

import java.io.*;
import java.util.*;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;

/**
 * @description
 * @Author Lin FuYuan
 * @date 2021/3/17
 */
public class Test {
    public static void main(String[] args) {
//        test();
//        test2();
        test4();
//        String s = "dataconfig";
//        test3(s);
    }


    public static void test() {
        Long a = 100L;
        Long b = 1000L;
        Comparator<Long> comparator = new Comparator<Long>() {
            @Override
            public int compare(Long o1, Long o2) {
                if (o1 > o2) {
                    return 1;
                } else {
                    return -1;
                }
            }
        };

        List<Long> list = new ArrayList<>();
        list.add(a);
        list.add(b);
        Collections.sort(list, comparator);
        System.out.println(list);

        TreeSet<Long> set = new TreeSet<>(comparator);
        set.add(a);
        set.add(b);
        System.out.println(set);
    }


    public static void test2() {
        String s = "/cluster/service/hadoop/env";
        String[] split = s.split("/");
        for (int i = 0; i < split.length; i++) {
            System.out.println(i + "    " + split[i]);
        }

    }


    public static void test3(String s) {

        switch (s) {
            case "dataconfig":
                System.out.println("1");
                break;
            case "hello":
                System.out.println("2");
                break;
            default:
                System.out.println("3");
                break;
        }
        String url = "127.0.0.1:8080:333";

        String x = "xxx:port:xxx";
        String[] ports = x.split("port");
        Integer m = null;
        for (int i = 0; i < ports.length; i++) {
            if(ports[i].equals("port")){
                m = i;
            }
        }
        if(m!=null){
            String[] split = url.split(":");
            Integer port = Integer.valueOf(split[m]);
            System.out.println(port);
        }


    }


    public static void test4(){
        String s = "10000";
        String[] split = s.split(":");
        String s1 = split[0];
        System.out.println(s1);

    }


    public void test5(){
        List<String> list = new ArrayList<>();
        Iterator<String> iterator = list.iterator();

        iterator.next();
    }






}


